import {Component} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';

import request from 'superagent';

import {Backend} from '../../providers/backend';

@Component({
  templateUrl: 'build/pages/tab-news/tab-news-files.html'
})
export class Files {

  static get parameters() {
    return [[NavController], [NavParams], [Backend]];
  }

  constructor(navCtrl, navParams, backend) {
    this.id = navParams.get('id');
    this.classid = navParams.get('classid');
    this.fuwu = 'http://gti.ftbj.net';
    this.navCtrl = navCtrl;
    this.navParams = navParams;
    this.backend = backend;
    this.inTheaters = {};
    this.contents = {};
    this.backend.contents(this.id,this.classid)
      .then(result => {
        this.contents = result;
        console.log(this.contents.title);
      });
  }

  doRefresh(refresher) {
    this.backend.contents(this.id,this.classid)
      .then(result => {
        this.contents = result;
        console.log(this.contents.title);
      });
    setTimeout(() => {
      console.log('Async operation has ended');
      refresher.complete();
    }, 2000);
  }

}
